package com.example.service;

import com.example.entity.ComponentTemplate;
import com.example.mapper.ComponentTemplateInstMapper;
import com.example.mapper.ComponentTemplateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ComponentTemplateInstServiceImpl implements ComponentTemplateInstService {

    @Autowired
    private ComponentTemplateInstMapper componentTemplateInstMapper;

    @Override
    public int create(ComponentTemplate componentTemplate) {
        return componentTemplateInstMapper.insert(componentTemplate);
    }

    @Override
    public int update(ComponentTemplate componentTemplate) {
        return componentTemplateInstMapper.update(componentTemplate);
    }

    @Override
    public int delete(Long id) {
        return componentTemplateInstMapper.deleteById(id);
    }

    @Override
    public ComponentTemplate getById(Long id) {
        return componentTemplateInstMapper.selectById(id);
    }

    @Override
    public List<ComponentTemplate> getByPageTemplateId(Long pageTemplateId) {
        return componentTemplateInstMapper.selectByPageTemplateId(pageTemplateId);
    }

    @Override
    public List<ComponentTemplate> getAll() {
        return componentTemplateInstMapper.selectAll();
    }
}

